Get Latest Crypto Quote
This is an important tutorial for people wanting to use stockseyes API for getting live crypto quotes.
In this tutorial, we will learn how to get current quotes for multiple crypto instruments in a single API request. This is useful when you want to monitor multiple cryptocurrencies simultaneously.
Get Multiple Crypto Quotes
Let's get the current quotes for multiple crypto instruments in a single request. You can add any number of crypto trading symbols in the instruments parameter, separated by commas. Common crypto trading symbols include: BTC-USD, ETH-USD, ADA-USD, DOT-USD, LINK-USD, etc.
- CURL
curl --location 'https://api.stockseyes.com/v1/public/crypto/quotes?instruments=BTC-USD,ETH-USD,ADA-USD' \
--header 'authorization: your-api-key'
Expected Response:
{
"quotes": {
"BTC-USD": {
"instrument": "BTC-USD",
"value": 102193.026379406,
"currentHourOHLV": {
"open": 102407.474353701,
"high": 102635.635949895,
"low": 102181.266331924,
"volume": 5034.38790740897
},
"currentDayOHLV": {
"open": 102159.437963581,
"high": 103390.801223023,
"low": 101901.208136156,
"volume": 44240.8235307751
},
"moving24HourOHLV": {
"open": 103533.642557907,
"high": 104025.635662362,
"low": 100962.420065812,
"volume": 153761.745078438
}
},
"ETH-USD": {
"instrument": "ETH-USD",
"value": 2258.29401064371,
"currentHourOHLV": {
"open": 2267.32483964437,
"high": 2275.96665512563,
"low": 2253.70143373284,
"volume": 165726.906826353
},
"currentDayOHLV": {
"open": 2296.83587009182,
"high": 2313.83981840636,
"low": 2251.40216349841,
"volume": 1333883.98037048
},
"moving24HourOHLV": {
"open": 2426.90835156867,
"high": 2449.09807439404,
"low": 2224.55298955467,
"volume": 4828060.17252152
}
},
"ADA-USD": {
"instrument": "ADA-USD",
"value": 0.4852,
"currentHourOHLV": {
"open": 0.4871,
"high": 0.4895,
"low": 0.4832,
"volume": 1250000.0
},
"currentDayOHLV": {
"open": 0.4923,
"high": 0.4956,
"low": 0.4812,
"volume": 9800000.0
},
"moving24HourOHLV": {
"open": 0.5012,
"high": 0.5089,
"low": 0.4789,
"volume": 45000000.0
}
}
}
}
Understanding the Response
The crypto quote response provides comprehensive information about each cryptocurrency:
Key Fields:
instrument: The trading symbol of the cryptocurrency (e.g., "BTC-USD")value: Current market price of the cryptocurrencycurrentHourOHLV: Open, High, Low, Volume data for the current hourcurrentDayOHLV: Open, High, Low, Volume data for the current trading daymoving24HourOHLV: Open, High, Low, Volume data for the last 24 hours
OHLCV Data:
open: Opening price for the time periodhigh: Highest price reached during the time periodlow: Lowest price reached during the time periodvolume: Trading volume during the time period
Popular Crypto Trading Symbols
Here are some commonly traded cryptocurrency symbols you can use:
- BTC-USD: Bitcoin
- ETH-USD: Ethereum
- ADA-USD: Cardano
- DOT-USD: Polkadot
- LINK-USD: Chainlink
- LTC-USD: Litecoin
- BCH-USD: Bitcoin Cash
- XRP-USD: Ripple
- SOL-USD: Solana
- MATIC-USD: Polygon
Rate Limits and Best Practices
- The API supports multiple crypto instruments in a single request (separated by commas)
- URL encode the instruments parameter when using multiple symbols
- Use the authorization header with your API key for authentication
- Consider implementing caching for frequently requested crypto data
- Monitor rate limits to ensure optimal API usage
Error Handling
Common error scenarios and their solutions:
- Invalid trading symbol: Ensure the crypto symbol is in the correct format (e.g., "BTC-USD")
- Authentication errors: Verify your API key is valid and properly included in the authorization header
- Network errors: Implement retry logic with exponential backoff